/////////////////////////////////////////////////////////////////////////////////////
// Include Files
#include "Objects\Sky.h"

// HACK: raising events in CGame
#include "Main\Game.h"

// managers
#include "Managers\MeshManager.h"

// rendering
#include "Rendering\RenderState.h"

/////////////////////////////////////////////////////////////////////////////////////
// CSky Implementation

CSky::CSky() : ABCObject()
{
	// create the render state
	m_pRenderState = new CRenderState();
	m_pRenderState->AddRef();

	// mesh
	m_pRenderState->SetMesh(L"Sky.mesh");

	// shader
	m_pRenderState->SetShader(L"Sky.cgfx");

	// matrices
	matrix_t matTransform = Matrix();
	m_pRenderState->SetTransform(matTransform);
	m_pRenderState->SetMatrixParam(L"g_matModelViewProj", PARAM_MAT_MODELVIEWPROJ_ROT);

	// textures
#pragma warning(disable:981)
	m_pRenderState->AddTexParam(L"Lake.texcube", L"SkySampler");
#pragma warning(default:981)

	// HACK: raising event in CGame
	CSingleton<CGame>()->RenderStateAdd.Raise(new CRenderStateEventArg(m_pRenderState));
}

CSky::~CSky()
{
	// HACK: raising event in CGame
	CSingleton<CGame>()->RenderStateRemove.Raise(new CRenderStateEventArg(m_pRenderState));
	m_pRenderState->Release();
}

void CSky::Update( float_t _fTime )
{
	(void)_fTime;
}
